import axios from 'axios'

// 获取列表
export function getListAPI (params) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'get',
    params
  })
}

// 新增
export function addtaskAPI (data) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'post',
    data
  })
}

// 删除
export function deltaskAPI (id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: 'delete'

  })
}

// 获取详情,用于回填
export function updatataskAPI (id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: 'get'
  })
}
// 编辑
export function changetaskAPI (data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: 'put',
    data
  })
}

// 搜索
export function searchTaskAPI (name) {
  return axios({
    url: `http://localhost:3001/data/?name=${name}`,
    method: 'get'
  })
}
